package com.flycms.module.offline.model;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.flycms.module.offline.service.OfflineActivityService;

/**
 *
 * <br/>Copyright 2020
 * <br/>All rights reserved
 * @author 沁言訫語
 * @version 2020年3月2日
 * @Date 2020年3月2日
 */

@Component
@Configuration
@EnableScheduling
public class OfflineSchedule {

    private static final Logger logger = LogManager.getLogger(OfflineSchedule.class);
    
    @Autowired
    protected OfflineActivityService offlineService;
    
    @Scheduled(cron = "0 0/1 * * * ?")
    private void OfflineActivityStatusUpdate() {
        logger.debug("更新线下活动状态");
        try {
            offlineService.offlineActivityStatusUpdate();
        } catch (Exception e) {
            logger.debug("", e);
        }
        
    }
    
}
